rmarkdownAnna Krystalli & Mike Croucher
3rd August 2016, University of Exeter
.mdstripped down
html
.Rmdrmarkdown integrates:– a documentantion language (.md)
with:
– a programming language (R)
single document to integrate data analysis with textual representations, linking data, code, and text
Rmarkdown & reproducibilityComputational science has led to exciting new developments:
Increasing computational complexity of analyses:
has exposed limitations in our ability to evaluate published findings.
Even basic analyses difficult to describe
Errors more easily introduced into long analysis pipelines
Knowledge transfer is inhibited
Results are difficult to replicate or reproduce
Complicated analyses cannot be trusted
Reproducibility has the potential to serve as a minimum standard for judging scientific claims when full independent replication of a study is not possible.
ultimately does not address the key question:
can we trust these results?
evdence needs:
rmarkdown can integrate tools, processes and outputs into evidence streams
at all stages of scientific process
empower your code and data
normal text
normal text
*italic text*
italic text
**bold text**
bold text
**bold italic text**
bold italic text
superscript^2^
superscript2
~~strikethrough~~
strikethrough
> this text will be quoted
this text will be quoted
`this text will appear as code` inline
this text will appear as code inline
a <- 10 the value of parameter *a* is 10
the value of parameter a is 10


<img src="resources/cheat.png" width="200px" />
Table Header | Second Header
------------- | -------------
Cell 1 | Cell 2
Cell 3 | Cell 4
| Table Header | Second Header |
|---|---|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
[Download R](http://www.r-project.org/)
[RStudio](http://www.rstudio.com/)
.md resourcesgithub.io websites: eg Andy South’s blog
Reproducible Research coursera MOOC
R code chunks can be used as a means render R output into documents or to simply display code for illustration
for more details see http://yihui.name/knitr/
knitr::opts_chunk$set(echo = TRUE, warning = F, message = F)knitr::kable() tablesrequire(knitr)
data(airquality)
kable(head(airquality), caption = "New York Air Quality Measurements")| Ozone | Solar.R | Wind | Temp | Month | Day |
|---|---|---|---|---|---|
| 41 | 190 | 7.4 | 67 | 5 | 1 |
| 36 | 118 | 8.0 | 72 | 5 | 2 |
| 12 | 149 | 12.6 | 74 | 5 | 3 |
| 18 | 313 | 11.5 | 62 | 5 | 4 |
| NA | NA | 14.3 | 56 | 5 | 5 |
| 28 | NA | 14.9 | 66 | 5 | 6 |
DT::kable() tablesrequire(DT)
data(airquality)
datatable(airquality, caption = "New York Air Quality Measurements")library(plotly)
set.seed(100)
d <- diamonds[sample(nrow(diamonds), 1000), ]
p <- ggplot(data = d, aes(x = carat, y = price)) +
geom_point(aes(text = paste("Clarity:", clarity)), size = 1) +
geom_smooth(aes(colour = cut, fill = cut)) + facet_wrap(~ cut)
ggplotly(p)
create your first
.Rmd!
datasets packagedata(package = .packages(all.available = TRUE))